#ifndef HOMEPAGE_H
#define HOMEPAGE_H
#include <QFile>
#include <QtWidgets>
#include "modbuswig.h"
#include "stm32.h"
#include "video.h"
#include "setwig.h"
#include "datashow.h"
#include <QJsonObject>
#include <QJsonDocument>
#include <QTcpSocket>
#include <QListWidgetItem>
#include "mqtthandler.h"
#include <QTimer>


namespace Ui {
class HomePage;
}

class HomePage : public QWidget
{
    Q_OBJECT

public:
    explicit HomePage(QWidget *parent = 0);
    ~HomePage();

private:
    Ui::HomePage *ui;
    ModbusWig *modbusWig;
    QTcpSocket *ftpSocket;
    Stm32 *stm32;
    SetWig *setWig;
    Video *video;
    DataShow *dataShow;
    int isAlive = 1;
    QTcpSocket *tcpSocket;
    QString currentConnectIPAndPort;
    QTimer *timer;
    void connectMQTT(QString ip,int port);
    void onReceUdpMsg(QJsonObject object);
    void connectTcp(QString ip, int port);
    void readyReadSlot();
    void connectedSlot();
    void sendPointTable();
    void disconnectedSlot();
    void uploadPointTableFile();
    void ftpConnectSlot();
    void ftpDisConnectSlot();
    void ftpReadyReadSlot();
    void sendStopFrame();
    void timeoutSlot();
private slots:
        void dataUpSlot(QByteArray);
};

#endif // HOMEPAGE_H
